package lc.数组;

/**
 * @description: 重塑矩阵
 * @author: qian
 * @createDate: 2021/8/25
 */
public class Math566 {

    public int[][] matrixReshape(int[][] nums, int r, int c) {

        int R = nums.length;
        int C = nums[0].length;
        if(r*c != R * C) {
            return nums;
        }
        int[][] reshapedNums = new int[r][c];
        for(int i = 0; i < R * C ; i++) {
            reshapedNums[i / c][i % c] = nums[i / C][i % C];
        }
        return reshapedNums;



    }
}
